package com.seres.user.vo.user;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.seres.feign.validator.annotation.NotBlank;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;

/**
 * @author Tan-Bowen
 * @version 1.0
 * @description TODO
 * @date 2021/8/5 10:44
 */
public class UserVo implements Serializable {

    private static final long serialVersionUID = -1329586163950018706L;

    @Data
    @Builder
    @ApiModel("用户信息更新参数")
    @NoArgsConstructor
    @AllArgsConstructor
    public static class Create {

        @ApiModelProperty("用户姓名")
        private String name;

        @ApiModelProperty("用户昵称")
        @NotBlank(message = "用户登录名必填")
        private String userName;

        @ApiModelProperty("1男 2女")
        private Integer sex;

        @ApiModelProperty("用户电话")
        private String tel;

        @ApiModelProperty("头像地址")
        private String headUrl;

        @ApiModelProperty("部门id 默认0(无)，1: 超级管理员")
        @NotNull(message = "所属机构必填")
        private Long deptId;

        @ApiModelProperty("1启用")
        @NotNull(message = "状态必填")
        private Integer state;
    }

    @EqualsAndHashCode(callSuper = true)
    @Data
    @ApiModel("用户信息更新参数")
    public static class Update extends Create{

        @NotNull(message = "唯一id必填")
        @ApiModelProperty("主键id")
        private Long id;
    }

    @Data
    @Builder
    @ApiModel("用户信息返回参数")
    public static class UserRes {

        @ApiModelProperty("主键id")
        private Long id;

        @ApiModelProperty("用户姓名")
        private String name;

        @ApiModelProperty("用户昵称")
        private String userName;

        @ApiModelProperty("1男 2女")
        private Integer sex;

        @ApiModelProperty("用户电话")
        private String tel;

        @ApiModelProperty("头像地址")
        private String headUrl;

        @ApiModelProperty("部门id 默认0(无)，1: 超级管理员")
        private Long deptId;

        @ApiModelProperty("1启用")
        private Integer state;

        @ApiModelProperty("部门名称")
        private String deptName;

        @ApiModelProperty("角色名称")
        private String roleName;

        @ApiModelProperty("最后登录时间")
        @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
        private Date lastLoginTime;

        @ApiModelProperty("创建时间")
        @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
        private Date createTime;

        @ApiModelProperty("修改时间")
        @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
        private Date updateTime;
    }

    @Data
    @Builder
    @ApiModel("用户信息查询")
    @NoArgsConstructor
    @AllArgsConstructor
    public static class Select {

        @ApiModelProperty("用户姓名")
        private String name;

        @ApiModelProperty("登录名")
        private String userName;

        @ApiModelProperty("1男 2女")
        private Integer sex;

        @ApiModelProperty("用户电话")
        private String tel;

        @ApiModelProperty("部门id 默认0(无)，1: 超级管理员")
        private Long deptId;

        @ApiModelProperty("1启用")
        private Integer state;
    }
}
